﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using DAL;
using BUS;
namespace WEBSITE_BANDEAL.Admin
{
    public partial class HinhAnh_View : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lit_title.Text = "Quản lý hình sản phẩm";
            lit_title_header.Text = "Danh sách hình sản phẩm";
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            int ma = int.Parse(Request.QueryString["id"]);
            HINH_ANHCollection lsp = HINH_ANHBUS.GetAll(ma);
            Repeater1.DataSource = lsp;
            Repeater1.DataBind();
        }

        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HINH_ANH sp = (HINH_ANH)e.Item.DataItem;
                 Literal lit_View = (Literal)e.Item.FindControl("lit_View");
                  lit_View .Text =  "<li id='img_"+ sp.MA.ToString() +"'> <img src='"+ sp.URL_HINH.ToString() + "' alt=''  height='298' /> <span>  <a href='"+ sp.URL_HINH.ToString()+"' class='view'></a></span> </li>";


            }
        }
    }
}